﻿using System;

namespace QNUnit.Core.Loggers
{
    public class ConsoleOut : ILogger
    {
        #region Fields

        private readonly string _suiteName;

        #endregion

        #region Constructors

        public ConsoleOut(string suiteName)
        {
            _suiteName = suiteName;
        }

        #endregion

        #region Public

        public void StartTestSuite()
        {
            Console.WriteLine("Started test suite {0}", _suiteName);
        }

        public void EndTestSuite()
        {
            Console.WriteLine("Finished test suite {0}", _suiteName);
        }

        public void StartTestFile(string testName, string fileName)
        {
            Console.WriteLine("Started tests {0} in QUnit file {1}", testName, fileName);
        }

        public void EndTestFile(string testName, string fileName)
        {
            Console.WriteLine("Finished tests {0} in QUnit file {1}", testName, fileName);
        }

        public void StartSubTest(string testName, int testIndex)
        {
            Console.WriteLine("Started {0}, Test #{1}", testName, testIndex);
        }

        public void EndSubTest(string testName, int testIndex)
        {
            Console.WriteLine("Finished {0}, Test #{1}", testName, testIndex);
        }

        public void PassSubTest(string testName, int testIndex, string message)
        {
            Console.WriteLine("Passed {0}, Test #{1}: {2}", testName, testIndex, message);
        }

        public void FailShortSubTest(string testName, int testIndex, string message)
        {
            Console.WriteLine("Failed {0}, Test #{1}: {2}", testName, testIndex, message);
        }

        public void FailSubTest(string testName, int testIndex, string message, string expected, string actual)
        {
            Console.WriteLine("Failed {0}, Test #{1}: {2}, Expected: {3}, Actual: {4}", testName, testIndex, message, expected, actual);
        }

        #endregion
    }
}
